import 'package:flutter_ahj_app/app/HttpRequest.dart';
import 'package:flutter_ahj_app/base/basewidget/model/BaseModel.dart';
import 'package:rxdart/rxdart.dart';

class ChangePasswordModel extends BaseModel{

  BehaviorSubject _dataSub ;

  Stream get dataStream => _dataSub.stream;


  requestMethod(String oldPassword, String newPassword){

    _dataSub = BehaviorSubject();

    HttpRequest.usersPWD(oldPassword, newPassword).listen((result){

      _dataSub.add(result);
    },onError: (e){
      errorData.add(e);
    });
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();

    if (_dataSub != null) {
      _dataSub.close();
    }
    errorData.close();
  }

}